package com.wealth.scsj.b_app.adapter;

import android.content.Context;
import android.graphics.Paint;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wealth.scsj.b_app.R;
import com.wealth.scsj.b_app.bean.RightBean;
import com.wealth.scsj.b_app.bean.SelectAppGoodsByStoreAndClassBean;


import java.util.List;

/**
 * 商品分类
 */

public class RightAdapter extends BaseQuickAdapter<SelectAppGoodsByStoreAndClassBean.DataBean, BaseViewHolder> {

    private Context mContext;

    public RightAdapter(Context context, List data) {
        super(R.layout.item_right_layout, data);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, SelectAppGoodsByStoreAndClassBean.DataBean item) {

        Glide.with(mContext).load(item.getUrlFrameCapture()).into((ImageView) helper.getView(R.id.icon_iv));
        helper.setText(R.id.title_tv, item.getGoodsName());
        helper.setText(R.id.num_tv, "库存" + item.getGoodsStorage());
        helper.setText(R.id.sale_tv, "月售"+item.getGoodsMonthlySales());
        helper.setText(R.id.price_tv, item.getGoodsPrice() + "");
        TextView oldprice_tv = (TextView) helper.getView(R.id.oldprice_tv);
        oldprice_tv.setText(item.getGoodsPromotionPrice() + "");
        oldprice_tv.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG |Paint.ANTI_ALIAS_FLAG);
//        helper.setText(R.id.oldprice_tv, item.getGoodsPromotionPrice() + "");//促销价
        switch (item.getGoodsState()) {
            case 1://1正常
                helper.setText(R.id.goods_state_tv,"已上架");
                break;
            case 2://下架
                helper.setText(R.id.goods_state_tv,"已下架");
                break;
            case 3://违规（禁售）
                helper.setText(R.id.goods_state_tv,"违规禁售");
                break;
            default:
                break;
        }


    }
}
